/*
 * Copyright (c) 2023 HPMicro
 *
 * SPDX-License-Identifier: BSD-3-Clause
 *
 */


#ifndef FLASH_UTIL_H
#define FLASH_UTIL_H

#include "hpm_common.h"

typedef struct
{
    uint32_t flash_size;
    uint32_t sector_size;
} nor_property_t;

#ifdef __cplusplus
extern "C" {
#endif


hpm_stat_t flash_init(void);

hpm_stat_t flash_get_property(nor_property_t *property);

hpm_stat_t flash_write(uint32_t offset, const uint8_t *buffer, uint32_t bytes_to_write);

hpm_stat_t flash_read(uint32_t offset, uint8_t *buffer, uint32_t bytes_to_read);

hpm_stat_t flash_erase(uint32_t offset, uint32_t bytes_to_erase);


#ifdef __cplusplus
}
#endif

#endif //FLASH_UTIL_H
